﻿@inject NetCoreCMS.IServices.IArticle_categoryService _article_category
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
    List<Article> focusGoods = ViewBag.focusGoods as List<Article>;
     List<Article> newGoods = ViewBag.newGoods as List<Article>;
     List<Article> redGoods = ViewBag.redGoods as List<Article>;
     List<Article> hotList = ViewBag.hotList  as List<Article>;
    List<Article> newsList = ViewBag.newsList as List<Article>;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>购物商城</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/idangerous.swiper.css" />
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/idangerous.swiper-2.1.min.js"></script>
    <link href="~/Mobile/css/goods.css" rel="stylesheet" />
    <script type="text/javascript">
        $(document).ready(function () {
            var mySwiper = new Swiper('.swiper-container', {
                calculateHeight: true,
                resizeReInit: true,
                pagination: ".pagination",
                autoplay: 5000,
                paginationClickable: true
            });
            $(".swiper-news").swiper({
		loop: true,
		direction: 'vertical',
		paginationHide :true,
        autoplay: 30000
      });
        });
    </script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>购物商城</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" href="javascript:;" onclick="showDialogBox('#category-box');">
                    <i class="iconfont icon-nav"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->
        <!--页面内容-->
        <div class="page__bd">
            <!--首页幻灯片-->
            <div id="slider" class="swiper-container">
                <div class="swiper-wrapper">
                    @foreach (Article dr in focusGoods)
                    {
                        <div class="swiper-slide">
                            <a asp-action="Show" asp-route-id="@dr.id">
                                <img src="@dr.img_url" />
                            </a>
                        </div>
                    }
                </div>
                <div class="pagination"></div>
            </div>
            <!--/首页幻灯片-->
            <!--nav-->
            <div class="weui-panel weui-panel_access">
                @{
                    var categoryList1 = _article_category.GetChildList(0, 0, 2);
                    int cateCount = categoryList1.Count / 4 + 1;
                }
                @for (int i = 0; i < cateCount; i++)
                {
                    var tempCate = categoryList1.Skip(i * 4).Take(4).ToList();
                    <div class="weui-flex wy-iconlist-box">
                        @foreach (Article_category cdr1 in tempCate)
                        {
                            <div class="weui-flex__item"><a asp-controller="Goods" asp-action="List" asp-route-id="@cdr1.id" class="wy-links-iconlist"><div class="img"><img src="@cdr1.img_url"></div><p>@cdr1.title</p></a></div>
                        }
                    </div>
                }
            </div>
            <!--/nav-->
            <!--news-->
            <div class="wy-ind-news">
                <i class="news-icon-laba"></i>
                <div class="swiper-container swiper-news">
                    <div class="swiper-wrapper">
                        @foreach (Article dr in newsList)
                        {
                            <div class="swiper-slide"><a asp-controller="News" asp-action="Show" asp-route-id="@dr.id">@dr.title</a></div>
                        }
                    </div>
                    <div class="swiper-pagination"></div>
                </div>
                <a asp-controller="News" class="newsmore"><i class="news-icon-more"></i></a>
            </div>
            <!--/news-->
            <!--推荐商品-->
            <div class="weui-panel weui-panel_access">
                <div class="weui-panel__hd">推荐商品</div>
                <div class="weui-panel__bd">
                    <div class="img-list">
                        <ul>
                            @foreach (Article dr in redGoods)
                            {
                                <li>
                                    <div class="wrap">
                                        <a asp-action="Show" asp-route-id="@dr.id">
                                            <img src="@dr.img_url" />
                                            <div class="note">
                                                <h2>@dr.title</h2>
                                                <p>
                                                    <i class="hot">库存 @dr.stock_quantity</i>
                                                    <i class="price">¥@dr.sell_price</i>元
                                                </p>
                                            </div>
                                        </a>
                                    </div>
                                </li>
                            }
                        </ul>
                    </div>

                </div>
            </div>
            <!--/推荐商品-->
            <!--人气排行-->
            <div class="weui-panel weui-panel_access">
                <div class="weui-panel__hd">人气排行</div>
                <div class="weui-panel__bd">
                    <div class="img-list">
                        <ul>
                            @for (int i = 0; i < hotList.Count; i++)
                            {
                                <li>
                                    <div class="wrap">
                                        <span class="number">@(i + 1)</span>
                                        <a asp-action="Show" asp-route-id="@hotList[i].id">
                                            <img src="@hotList[i].img_url" />
                                            <div class="note">
                                                <h2>@hotList[i].title</h2>
                                                <p>
                                                    <i class="hot">@hotList[i].click 次</i>
                                                    <i class="price">¥@hotList[i].sell_price</i>元
                                                </p>
                                            </div>
                                        </a>
                                    </div>
                                </li>
                            }
                        </ul>
                    </div>

                </div>
            </div>
            <!--/人气排行-->
            <!--最新商品-->
            <div class="wy-Module">
                <div class="wy-Module-tit-line"><span>最新商品</span></div>
                <div class="wy-Module-con">
                    <ul class="wy-pro-list clear">
                        @foreach (Article dr in newGoods)
                        {
                            <li>
                                <a asp-action="Show" asp-route-id="@dr.id">
                                    <div class="proimg"><img src="@dr.img_url"></div>
                                    <div class="protxt">
                                        <div class="name">@dr.title</div>
                                        <div class="wy-pro-pri">¥<span>@dr.sell_price</span></div>
                                    </div>
                                </a>
                            </li>
                        }
                    </ul>
                    @*<div class="morelinks"><a asp-action="List">查看更多 >></a></div>*@
                </div>
            </div>
            <!--/最新商品-->
            <!--版权信息-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
            <!--/版权信息-->
            <!--底部导航-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Footer.cshtml")
            <!--/底部导航-->
        </div>
        <!--/页面内容-->
    </div>

    <!--类别容器-->
    <div id="category-box" class="dialog-wrap">
        <div class="dialog-box">
            <div class="header">
                <a class="back" href="javascript:;" onclick="closeDialogBox('#category-box');">
                    <i class="iconfont icon-arrow-left"></i>
                </a>
                <h3>栏目类别</h3>
            </div>
            <ul class="navbar">
                @foreach(Article_category cdr1 in categoryList1)
                {
                <li>
                    <h3><a asp-action="List" asp-route-id="@cdr1.id">@cdr1.title</a></h3>
                    <p>
                        @{
                            var categoryList2 = _article_category.GetChildList(0, cdr1.id, 2);
                        }
                        @foreach(Article_category cdr2 in categoryList2)
                        {
                        <a asp-action="List" asp-route-id="@cdr2.id">@cdr2.title</a>
                        }
                    </p>
                </li>
                }
            </ul>
        </div>
    </div>
    <!--类别容器-->

</body>
</html>
